import http from '@/utils/http/axios'
import {ContentTypeEnum} from '@/enums/httpEnum'

enum Api {
    permissionList = '/permission/list',
    permissionCreate = '/permission/add',
    permissionDelete = '/permission/delete',
    permissionUpdate = '/permission/update',
    permissionGetPerbyId = '/permission/getPerbyId',
}

/**
 * @description: 根据id获取权限
 */
export function permissionGetPerbyId(params: any) {
    return http.request({
        url: Api.permissionGetPerbyId,
        method: 'GET',
        params,
    })
}

/**
 * @description: 修改
 */
export function permissionUpdate(params: any) {
    return http.request({
        url: Api.permissionUpdate,
        method: 'POST',
        params,
    },{
        isTransformRequestResult: false,
        isParseToJson: true,
        isShowMessage: true,
        successMessageText: '修改成功',
        errorMessageText: '修改失败'
    })
}

/**
 * @description: 删除
 */
export function permissionDelete(params: any) {
    return http.request({
        url: Api.permissionDelete,
        method: 'POST',
        params,
    },{
        isTransformRequestResult: false,
        isShowMessage: true,
        successMessageText: '删除成功',
        errorMessageText: '删除失败'
    })
}

/**
 * @description: 添加
 */
export function permissionCreate(params: any) {
    return http.request({
        url: Api.permissionCreate,
        method: 'POST',
        params,
    },{
        isTransformRequestResult: false,
        isParseToJson: true,
        isShowMessage: true,
        successMessageText: '添加成功',
        errorMessageText: '添加失败'
    })
}

/**
 * @description: 获取
 */
export function permissionList(params: any) {
    return http.request({
        url: Api.permissionList,
        method: 'GET',
        params,
    },{
        isTransformRequestResult: false
    })
}
